package com.ruoyi.system.api.factory;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.RemoteCustomerService;
import com.ruoyi.system.api.crm.RemoteEmployeeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author: isBao
 * @Description:TODO:职员信息feigen降级工厂
 */
@Component
public class RemoteEmployeeFallbackFactory implements FallbackFactory<RemoteEmployeeService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteEmployeeFallbackFactory.class);

    @Override
    public RemoteEmployeeService create(Throwable throwable) {
        log.error("crm服务调用失败:{}", throwable.getMessage());
        return new RemoteEmployeeService() {
            @Override
            public AjaxResult getEmployee() {
                return AjaxResult.error("没找到撰稿人");
            }
        };
    }
}
